<template>
  <div class="home">
    <h3>
      模块-- {{ name }}
    </h3>
    <button @click="init">chang</button>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
export default {
  name: 'Home',
  computed: {
    // mapState映射模块里是数据  mapState("模块名称")
    ...mapState("zhang", ["name"]),
    ...mapGetters("zhang", ["newName"])
  },
  methods: {
    ...mapMutations("zhang", ["CHANGE_NAME"]),
    ...mapActions("zhang", ["init"])
  }
}
</script>
